<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="styles  heet" href="css/reSize.css">
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/personCenter.css">
</head>
<body>
<div class="page orders" style="display: block">
    <div class="page-container">
        <h3>
            我的订单
        </h3>
        <table class="shop_table">
            <thead>
            <tr>
                <th class="order-number"><span>订单</span></th>
                <th class="order-date"><span>日期</span></th>
                <th class="order-total"><span>状态</span></th>
                <th class="amount"><span>合计</span></th>
                <th class="order-actions"></th>
            </tr>
            </thead>
            <script id="orderScript" type="text/html">
                {{if data.list.length==0}}
                <tr>
                    <td colspan="5">暂无订单数据</td>
                </tr>
                {{/if}}
                {{each data.list item index}}
                <tr>
                    <td class="order-number"><a href="#">{{item.orderCode}}</a></td>
                    <td class="order-date">{{item.createTime | dateFormat 'YYYY-MM-DD'}}</td>
                    <td class="order-total">{{item.optionResult}}</td>
                    <td class="amount">¥ {{item.orderAmount}}</td>
                    <td class="order-actions">
                        <a href="#" class="button">付款</a>
                        <a href="#" class="button">取消</a>
                        <a href="#" class="button" id="lookOrderDetails">查看</a>
                    </td>

                </tr>
                {{/each}}
            </script>
            <tbody id="orderHtml">

            </tbody>
        </table>
    </div>
</div>

<script src="js/jquery-1.8.3.min.js"></script>
<script src="js/moment-2.2.1.js"></script>
<script src="js/template-web.js"></script>
<script src="js/jdgj/config.js"></script>
<script >
    var user = JSON.parse(window.localStorage.getItem("user"));
    var userId = user!=null ?user.id:'26e0bbf545084a248cc56a386577d1e8';
    // 加载订单信息
    template.defaults.imports.dateFormat  = function(value, format){
        return config.formateDate(value, format);
    };
    var pageNo = pageNo | 1;
    $.get(config.baseUrl + "/order/listOrder.json",{userId: userId, pageNo:1}, function(result){
        if (result.status == 200) {
            var html = template("orderScript", result);
            $("#orderHtml").html(html);
        }
    });
</script>

</body>
</html>